import { request,requestUpload } from '../../utils/request'
import { getLiveId } from '../../utils/storage'

// 提交反馈
export function submitFeedback(paramObj) {
    return request('wxScan/commandInfo6', 'POST', {
        userId: paramObj.userId,
        content: paramObj.desc,
        phone_number: paramObj.phone,
        reason: paramObj.type,
        splid: getLiveId(),
        piclink: paramObj.imgurl,
    });
}

// 上传反馈图片
export function uploadFeedbackImg(path) {
    return requestUpload('beiJing/shangchuanTomcat', path);
}

// 选择图片
export function wxChooseImage(uploaderNum) {
    return new Promise((resolve, reject) => {
        wx.chooseImage({
            count: 3 - uploaderNum,
            sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: (res) => {
                resolve(res);
            },
            fail: (err) => {
                reject(err);
            },
        })
    });
}